Skip to content

test(frontend): fail when the drawer hold catches no React Aria event - #427

Merged
pdevito3 merged 3 commits into
mainfrom
test/issue-405-drawer-hold-assert
Nov 4, 2026
Merged

pdevito3 merged 3 commits into
mainfrom
test/issue-405-drawer-hold-assert

Conversation

@pdevito3

@pdevito3 pdevito3 commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Why

If a react-aria-components upgrade renames an event that the drawer tests hold, the hold catches nothing and the flake from #397 comes back with no failing test to explain it. This PR adds a test that fails with a message that names the event.

Closes #405

What changed

  • A new test in drawer.test.tsx opens a drawer with the hold on, and waits for scrollend on [data-sheet-scroll]. Then it presses Escape and waits for react-aria-sheet-close. It also checks that the drawer stays in data-entering and in data-exiting while the events are held, and that it closes when they are released.
  • holdSlides() now returns { endSlides, held }, so that the new test can read what it caught.

Scope

  • The check is in one new test, not in the six tests that use the hold. On a fast machine those six tests hold nothing when they call endSlides(), because they press Escape before the slide ends. An assert in them would fail on a correct run.
  • Known gap: scrollend is a browser event, so an upgrade cannot rename it. An upgrade can stop waiting for it. The test catches that only if the slide ends within about 50 ms of the event.

Tradeoffs

  • Each wait has a 10 s limit and the test has a 30 s limit. A correct run ends each wait when the event arrives. A stall of up to about 10 s in a wait does not fail the test. A longer stall fails it, and the message names a stalled runner as a possible cause. The 30 s limit gives a real rename its message and not a test timeout.

Blast Radius

Only the drawer test file changes. The new test adds about 1.2 s to the suite.

Verification

  • Five mistakes in the hold each fail only the new test, with a message that names the fault: the scrollend listener, the react-aria-sheet-close listener, the data-sheet-scroll attribute, and each of the two events no longer stopped. Before this change, all tests passed with both event names wrong.
  • The drawer tests pass 25 of 25 runs, one at a time, with a machine load average of about 100.
  • pnpm lint passes, and pnpm test passes 628 of 628 on the final base.

The drawer tests hold scrollend on [data-sheet-scroll] and
react-aria-sheet-close. If an upgrade renames one, the hold catches
nothing, the flake from #397 comes back, and no test shows why.

A healthy run of the six tests that use the hold catches nothing on a fast
machine, so they cannot make the check. A new test waits for each event.
Two 5 s waits left 5 s of the default 15 s for the render and the input. On
a slow runner a renamed event could then report a test timeout and not the
message that names the event.
A stall over 5 s on a correct run failed with a message that blames an
upgrade. The wait ends when the event arrives, so a longer limit costs a
correct run nothing.
@pdevito3
pdevito3 force-pushed the test/issue-405-drawer-hold-assert branch from ee393a3 to 070eadd Compare November 4, 2026 22:17
@pdevito3

pdevito3 commented Nov 4, 2026

Copy link
Copy Markdown
Owner Author

PASS+NOTES

  • Head: 070eaddaa3e82446c7dc02c4c43bd200ec874d16
  • Base: 1d8e82f2c7887049194e3fee47ac88c980d0d49f (main)
  • Patch-id (git patch-id --stable): 4da424fb156b8663427c5721e9dbd6e993723196

I did not write this code. The owner rebased the PR while I verified it. I first ran all lanes on head ee393a37 and base 972f7d0d. The patch-id is the same on both, and git range-diff shows all three commits as equal. The new base changes only an include list of the unit project and adds a Node test. I reran the guard, flake, lint, and suite lanes on the head above.

The guard. I made each change myself, one at a time, on both heads, and I restored it. I confirmed each restore with git diff and a file hash.

Change Result Message
Hold listens for a wrong scrollend name Only the new test fails holdSlides caught no scrollend on [data-sheet-scroll]. Did a react-aria-components upgrade rename the event or the attribute, or did the runner stall?
Hold listens for a wrong react-aria-sheet-close name Only the new test fails holdSlides caught no react-aria-sheet-close. Did a react-aria-components upgrade rename the event, or did the runner stall?
Library file renames react-aria-sheet-close Only the new test fails Same as the row above
Library file renames data-sheet-scroll Only the new test fails Same as the first row
Library file listens for a wrong scrollend name The new test passes. Two other tests fail expect(element).toHaveFocus() after a 15 s test timeout. This does not name the cause. See note 1

Flake, on 070eadda. All runs were one after another.

  • Drawer tests with CI=1 and 40 extra busy processes: 20 of 20 pass. The new test took a median of 1420 ms and a maximum of 2134 ms.
  • pnpm lint passes. pnpm test with no extra load passes 628 of 628.

Flake, on ee393a37.

  • Drawer tests with no extra load (machine load about 100): 20 of 20 pass.
  • Drawer tests with CI=1 and 40 extra busy processes: 20 of 20 pass.

The 10 s limit. It can still fail a correct run, but only on a freeze of more than 10 s during a short wait. I do not block on this.

  • I froze all Chromium processes of a run with SIGSTOP, once, at the start of a wait. A freeze of 6 s or 9 s passes. A freeze of 12 s fails the new test, 4 of 4, at either wait. The message names a stalled runner as a possible cause.
  • An older test that waits for the end of a slide has a limit of 15 s, which is its test timeout. It passed a 12 s freeze and failed a 20 s freeze. So the new test is a little less tolerant than the older tests.
  • I timed the waits in 3 full suite runs at a load of about 160 to 210. The first wait took 361 to 412 ms. The second took 0 to 52 ms. That is about 24 times below the limit.
  • In these runs the whole test took up to 21.5 s, so most of its time is outside the two waits (inferred). The 30 s test limit is needed. The default 15 s would have failed that run.
  • CI times for the new test: 1404 ms and 1295 ms on 070eadda, 1738 ms and 1016 ms on ee393a37. The drawer file took about 8.6 to 10.3 s.

The diff. Only drawer.test.tsx changes. The six other callers of holdSlides() read only endSlides, and the hold has no assert. So a test that catches no event still passes. I found no violation of docs/frontend/testing.md or the React standards, and the PR makes no doc line wrong.

Notes. None of these blocks.

  1. A library that stops waiting for scrollend is not caught with a clear message. This is the known gap in the PR body. A library cannot rename a browser event, so a rename does not reach this case.
  2. The PR body says that the limits keep a stalled runner from a false failure. That is true only up to 10 s.
  3. responsive-dialog.test.tsx is a flake under load, and this PR did not cause it. With CI=1 and 40 busy processes, it failed in 7 of 12 full runs on ee393a37, 1 of 2 on 070eadda, and 2 of 3 with the drawer test of base 972f7d0d. One of those runs on ee393a37 also failed one calendar.test.tsx test. The new test passed in all of these runs.
  4. CI on 070eadda is not green yet. new-feature (remove) failed in Run the .NET tests with The runner has received a shutdown signal and exit code 143. new-feature (keep) is still pending. This diff does not touch .NET code. This verdict does not cover those jobs.

@pdevito3
pdevito3 merged commit 916ad7c into main Nov 4, 2026
35 of 37 checks passed
@pdevito3
pdevito3 deleted the test/issue-405-drawer-hold-assert branch November 4, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(frontend): fail the drawer tests when the held React Aria events never fire

1 participant